$(function () {
    //======================
    //======设置查询条件========
    //======================
    //内部公司
    $("#wlykhwl_toolbar [name='gsId']").gsjgtree(1);


//======================
//========统计列表========
//======================
    var columns = [
        [
            {title: '业务', colspan: 4, width: 100},
            {title: '财务', colspan: 4, width: 100}
        ],
        [
            {field: 'gsname', title: '园区', width: 100, align: 'right'},
            {field: 'custname', title: '客户', width: 100, align: 'right'},
            {field: 'yw_yusk', title: '预收款', width: 100, align: 'right'},
            {field: 'yw_yingsk', title: '应收款', width: 100, align: 'right'},
            {field: 'xswjs_sl', title: '销售未结算数量', width: 100, align: 'right'},
            {field: 'xswjs_je', title: '销售未结算金额', width: 100, align: 'right'},
            {field: 'cw_yusk', title: '预收款', width: 100, align: 'right'},
            {field: 'cw_yingsk', title: '应收款', width: 100, align: 'right'}
        ]
    ];

    var grid = $('#wlykhwl_grid').datagrid({
        url: $.webPath() + '/report/wlykhwl/wlykhwlList',
        toolbar: "#wlykhwl_toolbar",
        pagination: true,
        rownumbers: true,
        singleSelect: true,
        collapsible: true,
        fit: true,
        fitColumns: true,
        pageNumber: 1,
        showFooter: true,
        queryParams: {
            endDate: $("#wlykhwl_toolbar [name='endDate']").val()
        },
        onLoadSuccess: function () {
        },
        columns: columns
    });


//搜索按钮
    $("#wlykhwl_toolbar [name='searchButton']").click(function () {
        $(grid).datagrid({
            queryParams: {
                endDate: $("#wlykhwl_toolbar [name='endDate']").val(),
                khMc: $("#wlykhwl_toolbar [name='khMc']").val(),
                gsId: $("#wlykhwl_toolbar [name='gsId']").val()
            }});
    });


});


